import { atom, selector } from "recoil";

const textState = atom({
    key:"textState",
    default:{

    }
})

const charCountState = selector({
    key: 'charCountState', // unique ID (with respect to other atoms/selectors)
    get: ({get,getCallback}) => {
        const text = get(textState);
        return text;
    },
    set:({set},newValue)=>{
        console.log(newValue)
        set(textState, {
            ...(newValue as {})
        })
        // return newValue
    }
});

export {
    textState,
    charCountState
}